package com.bdqn.qnnews.wemedia.convert;

import com.bdqn.qnnews.articel.api.dto.ApArticleDto;
import com.bdqn.qnnews.wemedia.entity.WmNews;
import com.bdqn.qnnews.wemedia.vo.WmNewsVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author xlzhang
 * @date 2023/12/28 15:00
 */
@Mapper
public interface WmNewsConvert {
    // 常量
    WmNewsConvert INSTANCE = Mappers.getMapper(WmNewsConvert.class);

    /**
     * Vo转换为 WmNews
     * @param vo Vo对象
     * @return 实体对象
     */
    @Mapping(target = "images",ignore = true)
    WmNews voToEntity(WmNewsVo vo);

    /**
     * 将自媒体端的文章实体转换为app端的文章dto
     * @param entity 文章实体
     * @return
     */
    ApArticleDto entityToArticleDto(WmNews entity);
}
